package com.zxy.feignclient.factory;

import com.zxy.feignclient.ProductClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author: Zxy
 * @description: Product Client 工厂实现自定义熔断效果
 * @date: 2021-07-23 15:02
 */
//@Component
public class ProductClientFactory implements FallbackFactory<ProductClient> {
    @Override
    public ProductClient create(Throwable throwable) {
        return new ProductClient() {
            @Override
            public String product(Integer id) {
                return "自定义熔断工厂实现服务熔断";
            }
        };
    }
}
